package study01;

import java.util.Arrays;

public class Java05_Object {
    public static void main(String[] args) {
//        String[] n = new String[3];
//        n[0] = "你要跳舞吗";
//        n[1] = "我爱你";
//        n[2] = "一场游戏一场梦";

        String[] n = {"你要跳舞吗", "我爱你", "一场游戏一场梦"};

        Musice musice1 = new Musice();
        musice1.type = "蓝调";
        musice1.isPunk("生活因你而火热", true, n);

        Musice musice2 = new Musice();
        musice2.type = "朋克";
        musice2.isPunk("你要跳舞吗", false, n);
    }
}

class Musice {
    String type;
    Boolean isPunk ( String name, Boolean isPlay, String[] tuiJian) {
        String str = "";
        if(tuiJian.length > 0){
//            str = Arrays.toString(tuiJian);
            str = "";
            for (int i = 0; i < tuiJian.length; i++) {
//                str += Arrays.toString(tuiJian);
                str += (i + 1) == tuiJian.length ? (tuiJian[i] + "") : (tuiJian[i] + "-");
            }
        }
        String isp = type == "朋克" ? "是" : "不是";
        String other = type == "朋克" ? "" : ", 它是" + type;
        System.out.println(name + isp + "朋克" + other);
        if (isPlay) {
            System.out.println("开始播放音乐, 推荐曲目：" + str);
        } else  {
            System.out.println("暂时不播放");
        }
        return  isPlay;
    }
}
